/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Screen;

import ClassFrame.Map;
import ClassFrame.Resource;
import GamePlay.CanvasGame;
import javax.microedition.lcdui.Graphics;
/**
 *
 * @author QuyetNM1
 */
public class Splash extends IScreen {
    private long startTime;
    private long currTime;
    public static boolean isSplash = true;
    public Splash(CanvasGame _canvas) {
        super(_canvas);
        startTime = System.currentTimeMillis();
        currTime = startTime;
    }
    
    public void initComponents(){
        
    }

    public void load_screen() {
        canvas.getResource().loadArray(Resource.splashArrayImages);
    }

    public void un_load_screen() {
        canvas.getResource().unLoadArray(Resource.splashArrayImages);
    }

    public void keyEvent(int keycode, int event) {
       
    }

    public void pointerEvent(int x, int y, int event) {
        
    }

    public void update() {
    }

    public void paint(Graphics g) {
        currTime = System.currentTimeMillis();
        canvas.getImage().drawImage(g, canvas, Resource.IMG_SPLASH, 0, 0);
        if (currTime - startTime >= 3000) {
            canvas.getMap().initRound(Map.round);
            canvas.setScreen(new Menu(canvas));
//            canvas.getResource().playSound(Resource.SOUND_MENU, -1);
            isSplash = false;
        }
    }
}
